"""
需求：
参考项目的登录功能（登录时需要输入用户名、密码、验证码），至少设计3条测试用例
要求1：定义变量保存测试数据（包括不同测试数据对应的测试结果）
要求2：至少写出3种以上不同的数据格式
要求3：遍历测试数据并打印到控制台，数据格式“用户名：xxx 密码：xxx 验证码：xxx 期望结果：xxx”
"""

# 定义变量：列表
login_data1 = [
["13800000001", "123456", "8888", "登录成功"],
["13800000001", "1234", "8888", "密码错误"],
["13800000001", "123456", "0000", "验证码错误"]
]
# 定义变量：元组
login_data2 = (
("13800000001", "123456", "8888", "登录成功"),
("13800000001", "1234", "8888", "密码错误"),
("13800000001", "123456", "0000", "验证码错误")
)
# 定义变量：列表元组
login_data3 = [
("13800000001", "123456", "8888", "登录成功"),
("13800000001", "1234", "8888", "密码错误"),
("13800000001", "123456", "0000", "验证码错误")
]
# 定义变量：列表字典
login_data4 = [
{"username": "13800000001", "password": "123456", "code": "8888", "result": "登录成功"},
{"username": "13800000001", "password": "666666", "code": "8888", "result": "密码错误"},
{"username": "13800000001", "password": "123456", "code": "0000", "result": "验证码错误"}
]
# 遍历数据3
for j in login_data3:
    # j = ("13800000001", "123456", "8888", "登录成功")
    print(f"用户名：{j[0]} 密码：{j[1]} 验证码：{j[2]} 期望结果：{j[3]}")
# 遍历数据4
for i in login_data4:
    # print(i) # i = {'username': '13800000001', 'password': '123456', 'code': '8888','result': '登录成功'}
    # print(i.get("username")) # 13800000001
    print(f"用户名：{i.get('username')} 密码：{i.get('password')} 验证码：{i.get('code')} 期望结果：{i.get('result')}")